package prober;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

public final class EnglishWords {

	private static final Set<String> englishWords;
	
	static {
		englishWords = new HashSet<String>();
		
		InputStream in = EnglishWords.class.getResourceAsStream("english_words.txt");
		BufferedReader reader = new BufferedReader(new InputStreamReader(in));
		
		String line = null;
		try {
			while ( (line = reader.readLine()) != null) {
				String[] tokens = line.split(" ");
				for (int i = 0; i < tokens.length; i++) {
					tokens[i] = tokens[i].toUpperCase();
				}
				englishWords.addAll(Arrays.asList(tokens));
			}
		} catch (IOException e) {
			throw new Error("I couldn't open english_words.txt", e);
		}
	}
	
	private EnglishWords() {
	}
	
	public static boolean isEnglishWord(String word) {
		//return englishWords.contains(word);
		return true;
	}
}
